<template>
    <div>
        <div class="head">
            <router-link to="/submitGoods">
                <van-icon name="arrow-left" class="i1" />
              </router-link>
            <h3>卡项详情</h3>
        </div>
        <h2>待支付</h2>
        <main>
            <div class="first">
                <section>
                    <p class="p1">
                        请在<van-count-down :time="time" @finish="finish"/>内完成支付
                    </p>
                    <!-- <p v-else>
                        支付已超时，订单自动取消
                    </p> -->
                    <h5>消费信息</h5>
                    <p class="p2">项目1</p>
                    <div class="d1">
                        <img :src="this.$route.query.item.cardImg" alt="">
                        <p>
                            <span>卡项</span>
                            {{this.$route.query.item.cardName}}{{this.$route.query.item.countAll}}次/{{this.$route.query.item.price}}
                        </p>
                        <span>{{this.$route.query.item.price}}元</span>
                    </div>
                        <h6>数量 <span>x1</span></h6>
                        <h6>小计 <span>{{this.$route.query.item.price}}元</span></h6>
                        <h6 class="line">商品总额 <span>{{this.$route.query.item.price}}元</span></h6>
                        <h6>合计 <span>{{this.$route.query.item.price}}元</span></h6>
                        <h6>应支付 <span class="red">{{this.$route.query.item.price}}元</span></h6>
                </section>
               
            </div>
            <div class="second">
                <section>
                    <h5>订单信息</h5>
                    <h6>订单编号： <span>{{this.$route.query.item.cardId}}</span></h6>
                    <h6>创建时间 <span>{{now}}</span></h6>
                </section>
            </div>
        </main>
        <router-link to="/index">
            <div class="fixed">
                <van-icon name="wap-home" class="i2"/>
            </div>
        </router-link>
        <van-dialog v-model="show" class="dialog">
            <p>订单提交成功</p>
            <p>请联系客服进行订单支付</p>
        </van-dialog>
    </div>
</template>

<script>
import Vue from 'vue';
import { CountDown, Toast } from 'vant';
import { Icon } from 'vant';
import { Dialog } from 'vant';
import axios from 'axios';

Vue.use(Icon);
Vue.use(CountDown);

    export default {
        data() {
            return {
                time:  20* 60 * 1000,
                show:true,
                pay:[],
                now:new Date().toLocaleString()
            };
        },
        components: {
            [Dialog.Component.name]: Dialog.Component,
        },
       methods:{
        finish(){
            Toast('支付超时，订单已自动取消')
        },
        // async getPay(data){
        //     let res=await axios({
        //         // url:'',
        //         method:"post",
        //         data:{
        //             cardId:this.$route.query.item.cardId,
        //             userId:this.$store.state.user.userId
        //         }
        //     })
        //     console.log(res,'订单编号');
        // }
       },
       mounted(){
        console.log(this.$route.query.item,'111');
       }
}
</script>

<style scoped>
*{
    margin: 0;
    padding: 0;
}
img{
    display: block;
}
.head{
    display: flex;
    height: 30px;
    width: 100%;
    padding-bottom: 30px;
    line-height: 30px;
    padding-top: 10px;
    background-color: rgb(255, 9, 9);
}
.i1{
    font-size: 30px;
    color: #fff;
    height: 30px;
    line-height: 30px;
}
h2{
    font-size: 28px;
    color: #fff;
    padding-left: 20px;
    height: 50px;
    line-height: 50px;
    background: rgb(255, 9, 9);
    padding-bottom: 70px;
}

h3{
    font-size: 20px;
    font-weight: normal;
    margin-left: 10px;
    color: #fff;
}

main{
    width: 100%;
    position: relative;
    box-sizing: border-box;
    height: 100%;
}
.first{
    position: absolute;
    border-radius: 10px;
    width: 95%;
    top: -50px;
    left: 10px;
    background-color: #f1f1f1;
    padding: 10px;
    box-sizing: border-box;
}
.first .p1{
    display: flex;
    align-items: center;
    justify-content: center;
    color: orange;
    font-size: 12px;
    height: 20px;
    line-height: 20px;
}

h5{
    font-size: 16px;
    width: 100%;
    line-height: 26px;
    height: 26px;
    color: #333;
    border-bottom: 1px solid #ccc;
}
.p2{
    font-size: 12px;
    color: #333;
    height: 30px;
    line-height: 30px;
    width: 100%;
}
.d1{
    display: flex;
    width: 100%;
    margin-bottom: 15px;
}
.d1 img{
    width: 40px;
    height: 40px;
    margin-right: 10px;
}
.d1>p{
    font-size: 16px;
    color: #333;
}
.d1 p>span{
    float: left;
    border: 1px solid #f20707;
    color: #f20707;
    line-height: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 12px;
    border-radius: 10px;
    text-align: center;
    margin-right: 10px;
}
.d1>span{
    font-size: 16px;
    margin-left: 30px;
}
h6{
    font-size: 16px;
    font-weight: normal;
    height: 40px;
    line-height: 40px;
    color: gray;
}
h6>span{
    float: right;
    color: #000;
}
.line{
    border-bottom: 1px solid #ccc;
    margin-bottom: 10px;
}
.red{
    color: #f20707;
}
.second{
    border-radius: 10px;
    position: absolute;
    left: 10px;
    top: 330px;
    background-color: #f1f1f1;
    width: 95%;
    padding: 10px;
    box-sizing: border-box;
}
.fixed{
    position: fixed;
    right: 10px;
    bottom: 100px;
    text-align: center;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: #f1f1f1;
}
 .i2{
    color: #f20707;
    font-size: 20px;
 }
 .dialog{
    padding: 10px;
 }
 .dialog p{
    text-align: center;
    width: 100%;
    line-height: 40px;
    height: 40px;
    font-size: 20px;
    color: #333;
 }
 .dialog p:nth-of-type(2){
    font-size: 16px;
    color: #777;
 }
</style>